package model

/**
 * created by lucus on 2019/4/4
 * e-mail: mcphilex1989@gmail.com
 * phone: 15652608401
 */
interface IView {
    val x: Int
    val y: Int
    val width: Int
    val height: Int
    fun draw()

    fun checkCollision(x: Int, y: Int, w: Int, h: Int, x2: Int, y2: Int, w2: Int, h2: Int): Boolean {
        return when {
            y2 + h2 <= y -> false
            y + h <= y2 -> false
            x2 + w2 <= x -> false
            x + w <= x2 -> false
            else -> true
        }
    }

}